← Delta Optimization track

Databricks · Delta Optimization

Learning plan.

A nine-lesson path through how Databricks stores, skips, compacts, and maintains Delta data. Built from the official Azure Databricks docs (verified June 2026). Finish able to design a table's layout, defend it in an interview, and debug it in production.

The story arc

A write makes files → layout decides what queries can skip → data skipping is the payoff → compaction & auto file sizing keep files right-sized → liquid clustering is the modern layout → predictive optimization runs the maintenance for you.

Lessons, timings & self-check

Go in order — each lesson builds on the last. After each one, answer its question without looking. Roughly 5 hours total, plus notebook runtime.

#LessonTimeSelf-check
01Traditional writes & small files25mWhy does a Spark write make many small files, and why is that slow to read?
02Partitioning (and when not to)35mWhen should you partition, and why is partitioning on customer_id bad?
03Data skipping & Z-ordering40mWhat stats does Delta keep per file, and how does ZORDER BY help?
04OPTIMIZE / compaction30mWhat does OPTIMIZE do, why is it idempotent, and when do you need OPTIMIZE FULL?
05Optimized writes30mHow do optimized writes work, and which operations enable them automatically?
06Auto compaction30mHow is auto compaction different from optimized writes and predictive optimization?
07Auto optimize & autotuning35mWhat's the autotuned target file size for a 5 TB table, and what doesn't auto optimize replace?
08Liquid clustering45mWhy can you change clustering keys with no rewrite, and why is it incompatible with partition/ZORDER?
09Deletion vectors (merge-on-read)35mHow do deletion vectors make DELETE/UPDATE/MERGE cheap, and how are the soft-deletes applied physically?
10VACUUM, time travel & retention40mWhy does VACUUM limit time travel, and which two retention dials must you raise to time-travel further back?
11Predictive optimization35mWhat does predictive optimization run, on which tables, and how do you enable it?

The decision framework to memorize

New table Use a Unity Catalog managed table, add liquid clustering on your top filter/join columns (≤ 4 keys), and enable predictive optimization. The platform then handles layout (OPTIMIZE), cleanup (VACUUM), and stats (ANALYZE).
Legacy / external / special very-large case You may still need partitioning (low-cardinality keys, ≥ 1 GB partitions, tables ≥ 1 TB), Z-order, a scheduled OPTIMIZE, or an explicit delta.targetFileSize. Lessons 02–07 teach exactly when.

Key numbers worth memorizing

< 1 TB → don't partition; ≥ 1 GB per partition
Data-skipping stats: first 32 columns by default
Autotune file size: 256 MB (< 2.56 TB) → 1 GB (> 10 TB)
Optimized writes / auto compaction (true): 128 MB
Liquid clustering: GA DBR 15.4 LTS+, up to 4 keys
OPTIMIZE FULL: DBR 16.0+ · convert partitioned: 18.1+
Deletion vectors: merge-on-read; write DBR 14.3 LTS+, read 12.2 LTS+
Retention dials: data files 7 days + history (log) 30 days — time travel needs both
Predictive optimization: UC managed only, on by default for accounts ≥ Nov 11 2024
VACUUM retention default: 7 days (delta.deletedFileRetentionDuration)